package team;

import java.util.Scanner;

public class testDemo {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String password = scanner.next();

        if (password.length() < 8) {
            System.out.println("NG");
        } else {
            int Acont = 0;
            int acont = 0;
            int Numcont = 0;
            int scont = 0;
            for (int i = 0; i < password.length(); i++) {
                if (password.charAt(i) >= '0' && password.charAt(i) <= '9') {
                    Acont=1;
                }
                if (password.charAt(i) >= 'a' && password.charAt(i) <= 'z') {
                    acont=1;
                }
                if (password.charAt(i) >= 'A' && password.charAt(i) <= 'Z') {
                    Numcont=1;
                }
                if (password.charAt(i) == '@' || password.charAt(i) == '#' || password.charAt(i) == '~' || password.charAt(i) == '%' || password.charAt(i) == '!' || password.charAt(i) == '*') {
                    scont=1;
                }
            }
            int cont = Acont + acont + Numcont + scont;
            if (cont == 4) {
                System.out.println("EG");
            } else if (cont == 3) {
                System.out.println("VG");
            }else if (cont == 2) {
                System.out.println("MG");
            }else if (cont == 1) {
                System.out.println("NG");
            }else{
                System.out.println("NG");
            }
        }
    }
}
